Source for file LC_Page_Sitemap.php
Documentation is available at LC_Page_Sitemap.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH . "pages/LC_Page.php");
* Sitemapプロトコル ファイル生成モジュール.
* このモジュールは Sitemapプロトコルに対応した XMLファイルを出力する.
* EC-CUBE インストールディレクトリの htmlディレクトリへ配置することにより動作する.
* このモジュールにより, 以下のページのサイトマップが生成される.
* 2. 管理画面のデザイン管理から生成したページ
* 5. html/mobile 以下の上記ページ
* このモジュールを設置後, 各検索エンジンにサイトマップを登録することにより, 検索エンジンの
* @see https://www.google.com/webmasters/tools/siteoverview?hl=ja
* @see https://siteexplorer.search.yahoo.com/mysites
* @author Kentaro Ohkouchi
* @version $Id:sitemap.php 15532 2007-08-31 14:39:46Z nanasess
* :TODO: 各ページの changefreq や priority を指定できるようにする
* :TODO: filemtime 関数を使えば、静的なページの更新時間も取得できそう
$this->staticURL = array(SITE_URL, MOBILE_SITE_URL, SITE_URL . "rss/index.php");
header("Paragrama: no-cache");
header("Content-type: application/xml; charset=utf-8");
print ("<?xml version='1.0' encoding='UTF-8'?>\n");
print ("<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>\n");
foreach ($editablePages as $editablePage) {
foreach ($products as $product) {
foreach ($mobileProducts as $mobileProduct) {
foreach ($details as $detail) {
foreach ($mobileDetails as $mobileDetail) {
* Sitemap の <url /> を生成する.
* @param string $loc ページの URL ※必須
* @param string $lastmod ファイルの最終更新日 YYYY-MM-DD or W3C Datetime 形式
* @param string $changefreq ページの更新頻度
* @param double $priority URL の優先度
* @return Sitemap 形式の <url />
* @see https://www.google.com/webmasters/tools/docs/ja/protocol.html#xmlTagDefinitions
printf("\t\t<lastmod>%s</lastmod>\n", $lastmod);
if (!empty($changefreq)) {
printf("\t\t<changefreq>%s</changefreq>\n", $changefreq);
printf("\t\t<priority>%01.1f</priority>\n", $priority);
* @param array $pageData すべてのページ情報の配列
* @return array TOPページの情報
foreach ($pageData as $page) {
if ($page['page_id'] == "1") {
* @param array $pageData すべてのページ情報の配列
foreach ($pageData as $page) {
if ($page['page_id'] > 4) {
* @param boolean $isMobile モバイルページを取得する場合 true
* @return array 検索エンジンからアクセス可能な商品一覧ページの情報
$sql = "SELECT category_id FROM dtb_category WHERE del_flg = 0";
$result = $conn->getAll($sql);
for ($i = 0; $i < count($result); $i++ ) {
// :TODO: カテゴリの最終更新日を取得できるようにする
$page = array("url" => SITE_URL . sprintf("%sproducts/list.php?category_id=%d", $mobile, $result[$i]['category_id']));
* @param boolean $isMobile モバイルページを取得する場合 true
* @return array 検索エンジンからアクセス可能な商品詳細ページの情報
$sql = "SELECT product_id, update_date FROM dtb_products WHERE del_flg = 0 AND status = 1";
$result = $conn->getAll($sql);
for ($i = 0; $i < count($result); $i++ ) {
$page = array("url" => SITE_URL. sprintf("%sproducts/detail.php?product_id=%d", $mobile, $result[$i]['product_id']),
"update_date" => $result[$i]['update_date']);
* @param string $where WHERE句
* @param array $arrVal WHERE句の値を格納した配列
$sql = ""; // データ取得SQL生成用
$arrRet = array(); // データ取得用
// SQL生成(url と update_date 以外は不要?)
$sql .= " page_id"; // ページID
$sql .= " ,page_name"; // 名称
$sql .= " ,php_dir"; // php保存先ディレクトリ
$sql .= " ,tpl_dir"; // tpl保存先ディdレクトリ
$sql .= " ,filename"; // ファイル名称
$sql .= " ,header_chk "; // ヘッダー使用FLG
$sql .= " ,footer_chk "; // フッター使用FLG
$sql .= " ,author"; // authorタグ
$sql .= " ,description"; // descriptionタグ
$sql .= " ,keyword"; // keywordタグ
$sql .= " ,update_url"; // 更新URL
$sql .= " ,create_date"; // データ作成日
$sql .= " ,update_date"; // データ更新日
$sql .= " dtb_pagelayout";
$sql .= " WHERE " . $where;
$sql .= " ORDER BY page_id";
$pageData = $objDBConn->getAll($sql, $arrVal);
// URL にプロトコルの記載が無い場合、SITE_URL を前置する。
$page = & $pageData[$key];
$page['url'] = SITE_URL . $page['url'];
* date形式の文字列を W3C Datetime 形式に変換して出力する.
* @param date $date 変換する日付
ereg("^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})",
// :TODO: time zone も取得するべき...
return sprintf("%04d-%02d-%02dT%02d:%02d:%02d+09:00",
$arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]);
Documentation generated on Fri, 24 Feb 2012 13:59:54 +0900 by Seasoft
|